
 <?php
$global=isSupperManagerForSession();
 ?>
<script type="text/javascript" src="/static/js/echarts.js"></script>
<link rel="stylesheet" type="text/css" href="/static/My97DatePicker/skin/WdatePicker.css" />
     <script charset="utf-8" src="/static/My97DatePicker/WdatePicker.js"></script>
     
     <section class="topBanners">
         <div class="icon"></div>
         <div class="topBannersNav">
         <span data-url="/admin/devlist/bg" data-container="rt_content"   class="topBannerItem">变更统计</span>

         </div>
      </section>
  



  
<div class="tj" id="tongji" style="width:90%;height:500px;margin-left:auto;margin-right:auto;margin-top:10px;">
	
	
</div>



<table class="table" style="margin-top:10px;width:80%;margin-bottom:40px;margin-left:auto;margin-right:auto;">

<tr>
<th><input id="all" type="checkbox"></th>
<th>日期</th>
<th>入库</th>
<th>领用</th>
<th>归还</th>
<th>报废</th>
</tr>
<?php
  foreach($zongData as $key=>$val)
	{

   ?>
   <tr data-id="<?php echo $val['title']; ?>">

    <td style="text-align:center;">
    <input type="checkbox" value="<?=$val['title']?>" class="checkBoxInput" name="checked[]" /></td>
	<td><?php echo $val['title'];?></td>
	<td><?php echo $val['n0'];?></td>
	<td><?php echo $val['n1'];?></td>
	<td><?php echo $val['n2'];?></td>
	<td><?php echo $val['n3'];?></td>
   </tr>
   <?php
	}
?>
</table>

<script>

function showBarRight(catgory,data) {
    
    
	option = {
		    title: {
		        text: '变更统计'
		    },
		    tooltip: {
		        trigger: 'axis'
		    },
		    legend: {
		        data:['入库','领用','归还','报废']
		    },
		    grid: {
		        left: '3%',
		        right: '4%',
		        bottom: '3%',
		        containLabel: true
		    },
		    toolbox: {
		        feature: {
		            saveAsImage: {}
		        }
		    },
		    xAxis: {
		        type: 'category',
		        boundaryGap: false,
		        data: catgory
		    },
		    yAxis: {
		        type: 'value'
		    },
		    series: [
		        {
		            name:'入库',
		            type:'line',
		            stack: '总量',
		            data:data[0]
		        },
		        {
		            name:'领用',
		            type:'line',
		            stack: '总量',
		            data:data[1]
		        },
		        {
		            name:'归还',
		            type:'line',
		            stack: '总量',
		            data:data[2]
		        },
		        {
		            name:'报废',
		            type:'line',
		            stack: '总量',
		            data:data[3]
		        }
		    ]
		};

        var myChart = echarts.init(document.getElementById('tongji'));
        myChart.setOption(option);
    

}
var datas=<?php echo  json_encode($datas); ?>;
var title=<?php echo  json_encode($bg_title); ?>;

showBarRight(title,datas);
</script>


 <script type="text/javascript">
      
      function myResearch(){
		   var url="/admin/devlist/tj";
		  
		   var firstType =$("#firstType").val();
		  
		   var stat =$("#stat").val();
		  
		   var page=$("#cpage").val();
		   var param={
				  
				   firstType:firstType,
				 
				   stat:stat, 
				  
				   page:page
		   };
		   ContentGet(url,param);
	   }
     
      
           $(function(){
        	   //设置搜索栏
        	   $(".research").click(function(){
        		   var page =$(this).attr("page");
        		   $("#cpage").val(page);
        		   myResearch();
        		   
        	   });
        	   
        	   //删除项
        	   $('.del').click(function(){
        		   var that =this;
        		   var url="/admin/devlist/delData";
        		   var id=$(that).parent().parent().attr('data-id');
        		   var param={
        				   id:id
        		   };
        		   cofirmsss_tishi(1,'您确定要删除吗?',function(id){
        			 
        			   AjaxRequest(url,param,function(data){
            			   if(data.err==0)
            			   {
            				   SuccessTiShi("操作成功");
            				   
            				   $(that).parent().parent().remove();
            				   myResearch();
            			   }
            			   else
            			   {
            				   ErrTiShi("操作失败");
            			   }
            		   });
        			   
        		   });
        	   });
        	   
        	   
        	   //导航
         	   $(".topBannerItem").click(function(){
         		   
         		   var attArr = $(this).attr();
             	   goToSelfLink(attArr);
             	   
         			
         	   });
        	 //启用
        	   $('.qy').click(function(){
        		   var that =this;
        		   var url="/admin/devlist/qyData";
        		   var id=$(that).parent().parent().attr('data-id');
        		   var param={
        				   id:id
        		   };
        		   cofirmsss_tishi(1,'您确定要启用吗?',function(id){
        			 
        			   AjaxRequest(url,param,function(data){
            			   if(data.err==0)
            			   {
            				   SuccessTiShi("操作成功");
            				   $(that).val("禁用");
            				  
            				 
            				  $(that).parent().parent().find(".dataStat").html("正常");
            				   $(that).removeClass("qy");
            				   $(that).addClass("jy");
            				   myResearch();
            			   }
            			   else
            			   {
            				   ErrTiShi("操作失败");
            			   }
            		   });
        			   
        		   });
        	   });
        	 
        	   //禁用
        	   $('.jy').click(function(){
        		   var that =this;
        		   var url="/admin/devlist/jyData";
        		   var id=$(that).parent().parent().attr('data-id');
        		   var param={
        				   id:id
        		   };
        		   cofirmsss_tishi(1,'您确定要禁用吗?',function(id){
        			 
        			   AjaxRequest(url,param,function(data){
            			   if(data.err==0)
            			   {
            				   SuccessTiShi("操作成功");
            				   $(that).val("启用");
            				   
            				   $(that).parent().parent().find(".dataStat").html("禁用");
            				   $(that).removeClass("jy");
            				   $(that).addClass("qy");
            				   myResearch();
            			   }
            			   else
            			   {
            				   ErrTiShi("操作失败");
            			   }
            		   });
        			   
        		   });
        	   });
        	   //编辑项
        	   $(".edit").click(function(){
        		   var that =this;
        		   var url="/admin/devlist/editData";
        		   var id=$(that).parent().parent().attr('data-id');
        		   var param={
        				   id:id
        		   };
        		   MyContentLoad(url,param);
        				 
        				
        			 //弹出：确认按钮
        			
        	   });

        	   $(".resetPwd").click(function(){
        		   var that =this;
        		   var url="/admin/devlist/resetPwd";
        		   var id=$(that).parent().parent().attr('data-id');
        		   var param={
        				   id:id
        		   };
        		   MyContentLoad(url,param);
        				 
        				
        			 //弹出：确认按钮
        			
        	   });
        	   
        	   
        	   
        	   //编辑项
        	   $(".add").click(function(){
        		   
        		   var that =this;
        		   var url="/admin/devlist/addData";
        		   var param={};
        		   MyContentLoad(url,param);
        			 //弹出：确认按钮
        			
        	   });
        	   
  			   //全选
  		
  				$("#all").click(function(){   
			    	if(this.checked){   
			        	$(".checkBoxInput").attr("checked", true);  
			        	$(".checkBoxInput").prop("checked", true);  
			    	}else{   
						$(".checkBoxInput").attr("checked", false);
						$(".checkBoxInput").prop("checked", false);
			    	}   
			    	var se=getAllSelectItem();
			    	//console.log(se);
			 	}); 
  			   
  			   
  				 $(".firstTypeR").change(function(){
    				   
    				   var url="/admin/devlist/selectTypeChange";
    		   		    var id=$(this).val();
    		   		   
    		   		    var param={
    		   				   id:id
    		   				   
    		   		    };
    				   AjaxRequest(url,param,function(data){
    		  			   if(data.err==0)
    		  			   {
    		  				   var html='<option value="">--选择--</option>';
    		  				   $.each(data.data,function(i,v){
    		  					 html +='<option value="'+v.id+'">'+v.dname+'</option>'
    		  				   })
    		  				   $(".secondTypeR").html(html);
    		  			   }
    		  			   else
    		  			   {
    		  				   ErrTiShi("操作失败");
    		  			   }
    		  		   	});
    				   
    			   });
  			
           });
           
	  </script>
   
